﻿Namespace Editor

    Module mFind

        'enum used to describe map element type
        Public Enum MapElementType
            None = 0
            NPC = 1
            Spawn = 2
            SafeZone = 3
            Door = 4
        End Enum

        'struct for map elements
        Public Structure MapElement
            Dim T As MapElementType
            Dim Idx As Long
        End Structure

        Public Function GetMapElementType(x As Integer, y As Integer) As MapElement

            'return var
            Dim ret As MapElement

            'find NPC's
            ret.Idx = NPC.GetNPCID(x, y)
            If ret.Idx > -1 Then
                'set type and return
                ret.T = MapElementType.NPC
                Return ret
            End If

            'find NPC's
            ret.Idx = Editor.Mobs.GetSpawn(x, y)
            If ret.Idx > -1 Then
                'set type and return
                ret.T = MapElementType.Spawn
                Return ret
            End If

            'TODO: (Editor) Find Safe zones

            'TODO: (Editor) Find Doors/Map links

            'failed to find an element, return ret with T value (type) as None, idx -1 (nothing)
            'setup default return var
            ret.T = MapElementType.None
            ret.Idx = -1
            Return ret

        End Function

    End Module

End Namespace
